﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using HCI.Questionaire.Exceptions;

namespace HCI.Questionaire.Entities
{
    public class MultipleAnswerConsequenceQuestion : ConsequenceQuestion
    {
        private bool m_IsRequired;
        public bool IsRequired
        {
            get { return m_IsRequired; }
            set { m_IsRequired = value; }
        }
        public override void ValidateAnswer()
        {
            if (this.ParentRelateValidate())
            {
                int count = 0;
                foreach (var item in this.AnswerCollection)
                {
                    if (item.IsAnswered)
                        count++;
                }

                if (count == 0)
                    throw new RequiredAnswerException("Required at less on answer.");
            }
        }
    }
}
